<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>wsClient</title>
</head>
<body>

<script>
  // 创建websocket
  let ws = new WebSocket("ws://localhost:8080/myWs")
  //向服务器发送hello
  ws.onopen=function (){
    ws.send("hello")
  }
  //监听数据ws://localhost:8080/myWs
  ws.onmessage=function (message){
    console.log(message.data)
  }
</script>
</body>
</html>